package main;

import javafx.application.Application;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.layout.BorderPane;
import javafx.stage.Stage;

public class Borderpane extends Application {

	public static void main(String[] args) {
		launch(args);
	}
	
	@Override
	public void start(Stage stage) throws Exception {
		Label top_label = new Label("Top");
		Label left_label = new Label("Left");
		left_label.setMinWidth(200);
		
		Label center_label = new Label("Center");
		Label bottom_label = new Label("Bottom");
		
		Label right_label = new Label("Right");
		right_label.setMinWidth(200);
		
		changeStyle(top_label, left_label, center_label, bottom_label, right_label);
		
		// Layout
		BorderPane pane = new BorderPane();
		
		// abstand Zwischen Top und dem Rest
		pane.setMargin(top_label, new Insets(10, 10, 10, 10));
		
		
		pane.setTop(top_label);
		pane.setLeft(left_label);
		pane.setCenter(center_label);
		pane.setBottom(bottom_label);
		pane.setRight(right_label);
		
		// Fensterinhalt
		Scene scene = new Scene(pane);
		
		stage.setTitle("JavaFX Frame");
		stage.centerOnScreen();
		
		stage.setHeight(500);
		stage.setWidth(600);
		
		// Oder
		// stage.setX();
		// stage.setY();
		
		// Minimum Hight und width
		stage.setMinHeight(150);
		stage.setMinWidth(150);
		
		stage.setScene(scene);
		
		stage.show();
	}
	
	/**
	 * 
	 * @param x
	 */
	private void changeStyle(Label... x){
		for (Label l : x) {
			l.setStyle("-fx-background-color: #90CCFC;");
		}
	}

}
